Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umpf: answer interactive prompts with default when --default set #50

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

a3f
Copy link
Member

@a3f a3f commented Nov 27, 2024

When building or tagging an umpf, umpf can ask which branch to use when multiple are available. Piping yes(1) into umpf in this case doesn't work, because the variable populated by read in that case is left empty.

Handle this case to reduce user confusion.

@michaelolbrich
Copy link
Member

I think a --yes/-y option that skips the read entirely and used the default make more sense.

@a3f
Copy link
Member Author

a3f commented Dec 19, 2024

Ok, but doesn't it make sense to have piping yes behave as expected as well?

@michaelolbrich
Copy link
Member

The problem I have with piping yes is, that is overwrites all reads. So umpf will not stop here:

umpf/umpf

Line 473 in 1a9792e

read -e -i n -p "Use ${branch} instead? [y/n]: " choice

And I think that's a really bad idea.

@a3f
Copy link
Member Author

a3f commented Dec 19, 2024

Fair point. I would rename the option then though. How about --default?

@michaelolbrich
Copy link
Member

Sounds good.

@a3f a3f requested a review from michaelolbrich January 25, 2025 09:04
@a3f a3f changed the title umpf: support piping yes into umpf umpf: answer interactive prompts with default when --default set Jan 25, 2025
Copy link
Member

@michaelolbrich michaelolbrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few, mostly cosmetic things left.

umpf Show resolved Hide resolved
umpf Outdated Show resolved Hide resolved
umpf Outdated Show resolved Hide resolved
When building or tagging an umpf, umpf can ask which branch to use when
multiple are available. Piping yes(1) into umpf in this case doesn't
work, because the variable populated by read in that case is left empty.

Provide for this use case, a --default option that will take a default
if one is known.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Copy link
Member

@michaelolbrich michaelolbrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks.

@michaelolbrich michaelolbrich merged commit f4bafaa into pengutronix:master Feb 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants